# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AdSense.V2.Model.PolicyIssue do
  @moduledoc """
  Representation of a policy issue for a single entity (site, site-section, or page). All issues for a single entity are represented by a single PolicyIssue resource, though that PolicyIssue can have multiple causes (or "topics") that can change over time. Policy issues are removed if there are no issues detected recently or if there's a recent successful appeal for the entity.

  ## Attributes

  *   `action` (*type:* `String.t`, *default:* `nil`) - Required. The most severe action taken on the entity over the past seven days.
  *   `adClients` (*type:* `list(String.t)`, *default:* `nil`) - Optional. List of ad clients associated with the policy issue (either as the primary ad client or an associated host/secondary ad client). In the latter case, this will be an ad client that is not owned by the current account.
  *   `adRequestCount` (*type:* `String.t`, *default:* `nil`) - Required. Total number of ad requests affected by the policy violations over the past seven days.
  *   `entityType` (*type:* `String.t`, *default:* `nil`) - Required. Type of the entity indicating if the entity is a site, site-section, or page.
  *   `firstDetectedDate` (*type:* `GoogleApi.AdSense.V2.Model.Date.t`, *default:* `nil`) - Required. The date (in the America/Los_Angeles timezone) when policy violations were first detected on the entity.
  *   `lastDetectedDate` (*type:* `GoogleApi.AdSense.V2.Model.Date.t`, *default:* `nil`) - Required. The date (in the America/Los_Angeles timezone) when policy violations were last detected on the entity.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Required. Resource name of the entity with policy issues. Format: accounts/{account}/policyIssues/{policy_issue}
  *   `policyTopics` (*type:* `list(GoogleApi.AdSense.V2.Model.PolicyTopic.t)`, *default:* `nil`) - Required. Unordered list. The policy topics that this entity was found to violate over the past seven days.
  *   `site` (*type:* `String.t`, *default:* `nil`) - Required. Hostname/domain of the entity (for example "foo.com" or "www.foo.com"). This _should_ be a bare domain/host name without any protocol. This will be present for all policy issues.
  *   `siteSection` (*type:* `String.t`, *default:* `nil`) - Optional. Prefix of the site-section having policy issues (For example "foo.com/bar-section"). This will be present if the `entity_type` is `SITE_SECTION` and will be absent for other entity types.
  *   `uri` (*type:* `String.t`, *default:* `nil`) - Optional. URI of the page having policy violations (for example "foo.com/bar" or "www.foo.com/bar"). This will be present if the `entity_type` is `PAGE` and will be absent for other entity types.
  *   `warningEscalationDate` (*type:* `GoogleApi.AdSense.V2.Model.Date.t`, *default:* `nil`) - Optional. The date (in the America/Los_Angeles timezone) when the entity will have ad serving demand restricted or ad serving disabled. This is present only for issues with a `WARNED` enforcement action. See https://support.google.com/adsense/answer/11066888.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :action => String.t() | nil,
          :adClients => list(String.t()) | nil,
          :adRequestCount => String.t() | nil,
          :entityType => String.t() | nil,
          :firstDetectedDate => GoogleApi.AdSense.V2.Model.Date.t() | nil,
          :lastDetectedDate => GoogleApi.AdSense.V2.Model.Date.t() | nil,
          :name => String.t() | nil,
          :policyTopics => list(GoogleApi.AdSense.V2.Model.PolicyTopic.t()) | nil,
          :site => String.t() | nil,
          :siteSection => String.t() | nil,
          :uri => String.t() | nil,
          :warningEscalationDate => GoogleApi.AdSense.V2.Model.Date.t() | nil
        }

  field(:action)
  field(:adClients, type: :list)
  field(:adRequestCount)
  field(:entityType)
  field(:firstDetectedDate, as: GoogleApi.AdSense.V2.Model.Date)
  field(:lastDetectedDate, as: GoogleApi.AdSense.V2.Model.Date)
  field(:name)
  field(:policyTopics, as: GoogleApi.AdSense.V2.Model.PolicyTopic, type: :list)
  field(:site)
  field(:siteSection)
  field(:uri)
  field(:warningEscalationDate, as: GoogleApi.AdSense.V2.Model.Date)
end

defimpl Poison.Decoder, for: GoogleApi.AdSense.V2.Model.PolicyIssue do
  def decode(value, options) do
    GoogleApi.AdSense.V2.Model.PolicyIssue.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AdSense.V2.Model.PolicyIssue do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
